package org.jeecg.modules.qyxx.service.impl;


import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.jeecg.modules.qyxx.entity.BgHzNdYqsq;
import org.jeecg.modules.qyxx.entity.req.BgNsrjbxxReq;
import org.jeecg.modules.qyxx.enumdemo.RedisKeyConstant;
import org.jeecg.modules.qyxx.mapper.BgHzNdYqsqMapper;
import org.jeecg.modules.qyxx.service.IBgHzNdYqsqService;
import org.jeecg.modules.qyxx.util.DateUtils;
import org.jeecg.modules.qyxx.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;

import java.util.List;

/**
 * @Description: 逾期申报汇总数据
 * @Author: ZJJ
 * @Date:   2021-06-11
 * @Version: V1.0
 */
@Service
// @DS("multi-datasource1")申报
public class BgHzNdYqsqServiceImpl extends MppServiceImpl<BgHzNdYqsqMapper, BgHzNdYqsq> implements IBgHzNdYqsqService {
    @Autowired
    private BgHzNdYqsqMapper bgHzNdYqsqMapper;

    @Override
    public Object hzNdYqsq(BgNsrjbxxReq req) {
        String djxh = req.getDjxh();
        List<String> years = DateUtils.getInstance().nearlyThreeYears(req.getKssj(), req.getJssj());
        LambdaQueryWrapper<BgHzNdYqsq> wrapper = Wrappers.lambdaQuery(BgHzNdYqsq.class);
        wrapper.eq(BgHzNdYqsq::getDjxh,djxh).in(BgHzNdYqsq::getTjnd, years);
        return bgHzNdYqsqMapper.selectList(wrapper);
    }
}
